import React, { useState } from "react";
import { Space, Table, Button } from "antd";
import type { TableProps } from "antd";
interface DataType {
  key: string;
  id: number;
  name: string;
  class: string;
  college: string;
  time: string;
  citys: string;
  froms: string;
  pay: number;
  status: string;
  GraduationYear: number;
}
const columns: TableProps<DataType>["columns"] = [
  {
    title: "学号",
    dataIndex: "id",
    key: "id",
    width: 190,
    render: (text) => <>{text}</>,
  },
  {
    title: "学生姓名",
    dataIndex: "name",
    key: "name",
    width: 190,
    render: (text) => <a>{text}</a>,
  },
  {
    title: "班级",
    dataIndex: "class",
    key: "class",
    width: 190,
  },
  {
    title: "学院名称",
    dataIndex: "college",
    key: "college",
    width: 190,
  },
  {
    title: "专业",
    key: "college",
    dataIndex: "college",
    width: 190,
  },
  {
    title: "创建时间",
    dataIndex: "time",
    key: "time",
    width: 190,
  },
  {
    title: "上班城市",
    dataIndex: "citys",
    key: "citys",
    width: 190,
  },
  {
    title: "市场部来源",
    dataIndex: "froms",
    key: "froms",
    width: 190,
  },
  {
    title: "毕业薪资",
    dataIndex: "pay",
    key: "pay",
    width: 190,
  },
  {
    title: "学生状态",
    dataIndex: "status",
    key: "status",
    width: 190,
  },
  {
    title: "毕业年份",
    dataIndex: "GraduationYear",
    key: "GraduationYear",
    width: 190,
  },
  {
    title: "操作",
    key: "action",
    fixed: "right",
    width: 250,
    render: () => (
      <Space size="middle">
        <Button type="primary">查看</Button>
        <Button type="primary">编辑</Button>
        <Button type="primary">删除</Button>
      </Space>
    ),
  },
];

const data: DataType[] = [
  {
    key: "1",
    id: 213541321,
    name: "John Brown",
    class: "网站2110A实训",
    college: "网站工程",
    time: "2023-03-21",
    citys: "上海",
    froms: "江西市场部",
    pay: 15000,
    status: "已毕业",
    GraduationYear: 2021,
  },
  {
    key: "1",
    id: 213541321,
    name: "John Brown",
    class: "网站2110A实训",
    college: "网站工程",
    time: "2023-03-21",
    citys: "上海",
    froms: "江西市场部",
    pay: 15000,
    status: "已毕业",
    GraduationYear: 2021,
  },
  {
    key: "1",
    id: 213541321,
    name: "John Brown",
    class: "网站2110A实训",
    college: "网站工程",
    time: "2023-03-21",
    citys: "上海",
    froms: "江西市场部",
    pay: 15000,
    status: "已毕业",
    GraduationYear: 2021,
  },
  {
    key: "1",
    id: 213541321,
    name: "John Brown",
    class: "网站2110A实训",
    college: "网站工程",
    time: "2023-03-21",
    citys: "上海",
    froms: "江西市场部",
    pay: 15000,
    status: "已毕业",
    GraduationYear: 2021,
  },
];
function EmplCom() {
  const [selectedRowKeys, setSelectedRowKeys] = useState<React.Key[]>([]);
  const onSelectChange = (newSelectedRowKeys: React.Key[]) => {
    console.log("selectedRowKeys changed: ", newSelectedRowKeys);
    setSelectedRowKeys(newSelectedRowKeys);
  };
  const rowSelection = {
    selectedRowKeys,
    onChange: onSelectChange,
  };

  return (
    <div>
      <Table
        rowSelection={rowSelection}
        columns={columns}
        dataSource={data}
        scroll={{ x: 1200 ,y:300}}
      />
    </div>
  );
}

export default EmplCom;
